package com.hao1st.service1.biz.distributedtx.controller;

import com.hao1st.service1.biz.distributedtx.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/user")
public class UserController {

    @Resource
    private UserService userService;

    @PostMapping(value = "/index")
    public String index() {

        if (userService.insNewUser() != 0) {
            return "分布式事务创建用户成功";
        }
        return "分布式事务创建用户失败";
    }
}
